import pytesseract
from PIL import Image


img = Image.open("33.png")
# 二值化处理
img = img.convert("L")
table = []
threshold = 200
for i in range(256):
    if i < threshold:
        table.append(0)
    else:
        table.append(255)
img = img.point(table, "1")
img.save("44.png")
text = pytesseract.image_to_string(img)  # 使用简体中文解析图片
print(text)

